package com.kepler.social.common.constants;

public enum PostType {
    text(1, "文本"),
    text_image(2, "图片文字"),
    text_video(3, "视频文字"),
//    text_audio(4, "音频文字"),
    ;

    public int code;
    public String name;

    PostType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static boolean exists(int code) {
        return null != getByType(code);
    }

    public static PostType getByType(int code) {
        for (PostType enum_ : values()) {
            if (enum_.getCode() == code) {
                return enum_;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

}
